Skip to content

Update StoreRegistry to dynamically load clustering classes#1005

Merged
dsoumis merged 3 commits into
apache:mainfrom
csutherl:make-clustering-optional-storeconfig
May 12, 2026
Merged

Update StoreRegistry to dynamically load clustering classes#1005
dsoumis merged 3 commits into
apache:mainfrom
csutherl:make-clustering-optional-storeconfig

Conversation

@csutherl

@csutherl csutherl commented May 8, 2026

Copy link
Copy Markdown
Member

I noticed that if you use the StoreConfigListener but tomcat doesn't have the clustering JARs available that it prevents tomcat from starting successfully. The StoreConfigListener had hard dependencies on the clustering libraries, so I made those dynamic. Also added a few tests to make sure the reflection is working as expected.

@csutherl csutherl requested a review from rmaucher May 8, 2026 13:19
@csutherl csutherl changed the title Fix StoreRegistry to dynamically load clustering classes Update StoreRegistry to dynamically load clustering classes May 8, 2026
Comment thread test/org/apache/catalina/storeconfig/TestStoreRegistry.java Outdated
Comment thread test/org/apache/catalina/storeconfig/TestStoreConfig.java Outdated
@rmaucher

Copy link
Copy Markdown
Contributor

Too bad we have to add that complexity, but I guess the clustering is optional elsewhere, so ok.

csutherl and others added 3 commits May 11, 2026 14:49
Update StoreRegistry to use lazy initialization with dynamic class loading
for optional clustering interfaces, preventing NoClassDefFoundError when
StoreConfigLifecycleListener is configured but clustering classes are
unavailable.

This change aligns StoreConfig behavior with other Tomcat components like
Catalina.addClusterRuleSet() which already handle optional clustering
gracefully via reflection.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
… clustering installations where catalina-ha.jar is present but catalina-tribes.jar is not.
@csutherl csutherl force-pushed the make-clustering-optional-storeconfig branch from 8dc63e1 to 3b7883e Compare May 11, 2026 18:54
@dsoumis dsoumis merged commit f35ac34 into apache:main May 12, 2026
6 checks passed
@csutherl csutherl deleted the make-clustering-optional-storeconfig branch May 12, 2026 16:07
dsoumis added a commit that referenced this pull request May 12, 2026
* Fix StoreRegistry to dynamically load clustering classes

Update StoreRegistry to use lazy initialization with dynamic class loading
for optional clustering interfaces, preventing NoClassDefFoundError when
StoreConfigLifecycleListener is configured but clustering classes are
unavailable.

This change aligns StoreConfig behavior with other Tomcat components like
Catalina.addClusterRuleSet() which already handle optional clustering
gracefully via reflection.

* Catch NoClassDefFoundError in StoreRegistry.tryAddClass() for partial clustering installations where catalina-ha.jar is present but catalina-tribes.jar is not.

---------

Co-authored-by: Dimitris Soumis <jimsoumis@gmail.com>
dsoumis added a commit that referenced this pull request May 12, 2026
* Fix StoreRegistry to dynamically load clustering classes

Update StoreRegistry to use lazy initialization with dynamic class loading
for optional clustering interfaces, preventing NoClassDefFoundError when
StoreConfigLifecycleListener is configured but clustering classes are
unavailable.

This change aligns StoreConfig behavior with other Tomcat components like
Catalina.addClusterRuleSet() which already handle optional clustering
gracefully via reflection.

* Catch NoClassDefFoundError in StoreRegistry.tryAddClass() for partial clustering installations where catalina-ha.jar is present but catalina-tribes.jar is not.

---------

Co-authored-by: Dimitris Soumis <jimsoumis@gmail.com>
dsoumis added a commit that referenced this pull request May 12, 2026
* Fix StoreRegistry to dynamically load clustering classes

Update StoreRegistry to use lazy initialization with dynamic class loading
for optional clustering interfaces, preventing NoClassDefFoundError when
StoreConfigLifecycleListener is configured but clustering classes are
unavailable.

This change aligns StoreConfig behavior with other Tomcat components like
Catalina.addClusterRuleSet() which already handle optional clustering
gracefully via reflection.

* Catch NoClassDefFoundError in StoreRegistry.tryAddClass() for partial clustering installations where catalina-ha.jar is present but catalina-tribes.jar is not.

---------

Co-authored-by: Dimitris Soumis <jimsoumis@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants